home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm2 / mmpgpm11.lha / MM_PGPManager.rexx < prev   
OS/2 REXX Batch file  |  1996-05-14  |  22KB  |  646 lines

  1. /*
  2.  
  3.     MM_PGPManager
  4.  
  5.     © 1995/1996 by Sebastian Bleikamp ...
  6.     (All rights reserved.)
  7.  
  8.     V. 1.1
  9.  
  10.  
  11.  
  12.  
  13.    This program is free to everyone  !
  14.  
  15.    USE IT AT YOUR OWN RISC !!!
  16.  
  17.  
  18.  
  19.  
  20.     Neu seit Version 0.1:
  21.  
  22.       + Globale Variablennamen geändert.
  23.  
  24.       + -> GetKeys : Fügt alle Keys aus einer Message zum Public-Key
  25.                      Ring dazu. (Wenn es der User bestaetigt... )
  26.  
  27.       + -> Save    : Entschlüsselt eine Nachricht und speichert sie dann als Klartext in die
  28.                      Msg.-Base.
  29.  
  30.     Neu seit Version 0.2:
  31.  
  32.       + E-Mails werden erkannt, und die Adressierung berücksichtigt.
  33.         Dazu wurden 2 Funktionen geschrieben: Get_MM_Msg und Edit_MM_Msg.
  34.         Sie lesen (wenn vorhanden) die E-Mail Adresse aus und schreiben sie nacher
  35.         wieder als 1. Zeile in die Msg.
  36.  
  37.     Neu seit Version 0.3:
  38.  
  39.       + Es gibt jetzt 2 Funktionen zum Verschluesseln der Messages:
  40.         Einmal wird die Message nur verschluesselt (WRITE) und bei der
  41.         anderen zusätzlich noch unterschrieben (WRITES)
  42.  
  43.       + Alle Texte jetzt in Englisch (außer den Docs ...)
  44.  
  45.       + Endlich:
  46.         Jetzt mit Doks !!!
  47.  
  48.  
  49.     Neu seit Version 0.4:
  50.  
  51.       + Funktion PUTFILE:
  52.         Verschlüsselt ein File (auch binär) und hängt es im ASCII Format
  53.         an eine Message an.
  54.  
  55.       + Funktion GETFILE:
  56.         Speichert den Plaintext einer Message in ein File.
  57.         Sehr nützlich, wenn man verschlüsselte Binärfiles empfängt.
  58.  
  59.  
  60.     Neu seit Version 0.5 (nicht veröffentlicht):
  61.  
  62.       + Jetzt mit Requester, der die Public-Keys auflistet.
  63.         Wenn Abbruch eingegeben wird, kann man die User-ID per
  64.         Hand eingeben.
  65.  
  66.       + Jetzt mit GUI. Einfach spitze !!!
  67.  
  68.       + Jetzt mit Sicherheitsabfrage, wenn Messages bereits gesendet wurden,
  69.         importiert oder geschützt sind.
  70.  
  71.  
  72.     Neu seit Version 0.6 (nicht veröffentlicht):
  73.  
  74.       + Bug in der Funktion für die Public-Keyliste entfernt.
  75.         Routine optimiert.
  76.  
  77.       + Remove:
  78.         Beseitigt die Signature vom File, funktioniert wie SAVE.
  79.  
  80.       + Jetzt mit Verschlüsseln für mehrere User !!!
  81.  
  82.  
  83.      Neu seit Version 0.7:
  84.  
  85.       + Bessere Konfiguration.
  86.  
  87.       + Einige Bugs beseitigt, läuft jetzt zuverlässiger.
  88.         (Hoffentlich ...)
  89.  
  90.  
  91.      Neu seit Version 0.8:
  92.  
  93.       + Nachdem bei der Vorstellung in der Amiga 4/96 kein Hinweis auf den Autor
  94.         angegeben war, habe ich mich entschlossen, einen About Requester ins
  95.         Hilfe-Menue aufzunehmen.
  96.  
  97.       + Jetzt mit einfacher(er) Konfiguration durch Konfigfile !
  98.  
  99.  
  100.  
  101.     Neu seit Version 1.0:
  102.  
  103.       + Funktioniert jetzt mit PGP 2.6.3i !!!
  104.         Danke fuer alle Tips & gemeldeten Bugs !
  105.  
  106.       + Bugfix: Auswahlliste war leer. (Formatfehler !)
  107.  
  108.  
  109.  
  110.  
  111. */
  112.  
  113.  
  114. ADDRESS 'MAILMANAGER'
  115. PARSE ARG system.area system.msg system.funk
  116.  
  117.  
  118.  
  119.  
  120.  
  121. /*-----------------------------------------------------------------------*/
  122. /* Init:                                                                 */
  123. /*-----------------------------------------------------------------------*/
  124.  
  125.  
  126. system.configfile   =   'MM:Config/MM_PGPManager.cfg'
  127.  
  128. call Read_Config
  129.  
  130. system.output.sig   =   system.output||'.sig'
  131. system.output.asc   =   system.output||'.asc'
  132. list.count=0
  133.  
  134.  
  135.  
  136. /*-----------------------------------------------------------------------*/
  137. /* Main:                                                                 */
  138. /*-----------------------------------------------------------------------*/
  139.  
  140.  
  141.  
  142.  
  143. if system.funk='GUI' | system.funk=''
  144.   then system.leave=0
  145.   else system.leave=1
  146.  
  147.  
  148. Main:
  149.     do while system.leave~=2
  150.         if system.leave=0 then do
  151.             system.funk=''
  152.             call Get_Mode
  153.         end
  154.         else system.leave=2
  155.  
  156.         SELECT
  157.             WHEN UPPER(system.funk)='READ'    THEN CALL PGP_Read
  158.             WHEN UPPER(system.funk)='WRITE'   THEN CALL PGP_Write
  159.             WHEN UPPER(system.funk)='WRITES'  THEN CALL PGP_Write_Sign
  160.             WHEN UPPER(system.funk)='SIGN'    THEN CALL PGP_Sign
  161.             WHEN UPPER(system.funk)='KEYADD'  THEN CALL PGP_Keyadd
  162.             WHEN UPPER(system.funk)='GETKEYS' THEN CALL PGP_GetKeys
  163.             WHEN UPPER(system.funk)='SAVE'    THEN CALL PGP_Save
  164.             WHEN UPPER(system.funk)='GETFILE' THEN CALL PGP_GetFile
  165.             WHEN UPPER(system.funk)='PUTFILE' THEN CALL PGP_PutFile
  166.             WHEN UPPER(system.funk)='REMOVE'  THEN CALL PGP_Remove
  167.             WHEN UPPER(system.funk)='HELP'    THEN CALL Prog_Help
  168.             OTHERWISE CALL Prog_Help
  169.         END
  170.     end
  171.     exit
  172. return
  173.  
  174.  
  175.  
  176.  
  177. /*-----------------------------------------------------------------------*/
  178. /* Read / Write Functions:                                               */
  179. /*-----------------------------------------------------------------------*/
  180.  
  181. PGP_Read:
  182.  
  183.     drop MSG_Stem.
  184.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  185.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  186.     ADDRESS command system.pgp.read||' '|| system.tempfile
  187.     MM_DeleteFile system.tempfile
  188.  
  189. RETURN
  190.  
  191.  
  192. PGP_Write:
  193.  
  194.     drop MSG_Stem.
  195.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  196.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'          Do you want to encrypt this message ?          ' ; GADGETS='*   _Yes   |   _No   '
  197.     MM_Requester '"MM_PGPManager: Write"' 'REQTEXT' 'GADGETS'
  198.     IF RC~=1 THEN return
  199.  
  200.     call Check_Write
  201.  
  202.     user = MSG_Stem.TO
  203.     call Get_Multi_User
  204.  
  205.     CALL Get_MM_Msg
  206.     ADDRESS COMMAND system.pgp.write||' -o '||system.output||' '||system.tempfile || ' ' ||user
  207.     CALL Edit_MM_Msg
  208.  
  209.     MM_EditMsg system.area system.msg 'MSG_Stem'
  210.     MM_DeleteFile system.tempfile
  211.     MM_DeleteFile system.output
  212.  
  213. RETURN
  214.  
  215. PGP_Write_Sign:
  216.  
  217.     drop MSG_Stem.
  218.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  219.  
  220.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'   Do you really want to sign and encrypt this msg. ?    ' ; GADGETS='*   _Yes   |   _No   '
  221.     MM_Requester '"MM_PGPManager: Write & Sign"' 'REQTEXT' 'GADGETS'
  222.     IF RC~=1 THEN return
  223.  
  224.     call Check_Write
  225.  
  226.     REQTEXT= '"Please enter the sysop´s user id:"'
  227.     MM_StringReq REQTEXT 'system.sysopid'
  228.     if rc~=0 then return
  229.  
  230.     user = MSG_Stem.TO
  231.     call Get_Multi_User
  232.  
  233.     CALL Get_MM_Msg
  234.     ADDRESS COMMAND system.pgp.write_sign||' -o '||system.output||' -u "'||system.sysopid||'"  '||system.tempfile||' '||user
  235.     CALL Edit_MM_Msg
  236.  
  237.     MM_EditMsg system.area system.msg 'MSG_Stem'
  238.     MM_DeleteFile system.tempfile
  239.     MM_DeleteFile system.output
  240.  
  241. RETURN
  242.  
  243.  
  244.  
  245. PGP_Sign:
  246.  
  247.     drop MSG_Stem.
  248.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  249.  
  250.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'        Do you really want to sign this message ?        ' ; GADGETS='*   _Yes   |   _No   '
  251.     MM_Requester '"MM_PGPManager: Sign"' 'REQTEXT' 'GADGETS'
  252.     IF RC~=1 THEN return
  253.  
  254.     call Check_Write
  255.  
  256.     REQTEXT= '"Please enter the sysop´s user id:"'
  257.     MM_StringReq REQTEXT 'system.sysopid'
  258.     if RC~=0 then return
  259.  
  260.     CALL Get_MM_Msg
  261.     ADDRESS command system.pgp.sign||' -o '||system.output||' -u "'||system.sysopid||'" '||system.tempfile
  262.     CALL Edit_MM_Msg
  263.  
  264.     MM_EditMsg system.area system.msg 'MSG_Stem'
  265.     MM_DeleteFile system.tempfile
  266.     MM_DeleteFile system.output
  267.  
  268. RETURN
  269.  
  270.  
  271. PGP_Keyadd:
  272.  
  273.     drop MSG_Stem.
  274.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  275.  
  276.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'          Do you really want to add a keyfile ?          ' ; GADGETS='*   _Yes   |   _No   '
  277.     MM_Requester '"MM_PGPManager: Add Key"' 'REQTEXT' 'GADGETS'
  278.     IF RC~=1 THEN return
  279.  
  280.     call Check_Write
  281.  
  282.     user = system.sysopid
  283.     call Get_User
  284.  
  285.     ADDRESS command system.pgp.keyadd||' '||user||' '||system.output.asc
  286.     MM_ReadStem system.output.asc 'MSG_Stem.TEXT' 'APPEND'
  287.     MM_WriteStem system.tempfile 'MSG_Stem.TEXT'
  288.  
  289.     MSG_Stem.FILE = system.tempfile
  290.     MM_EditMsg system.area system.msg 'MSG_Stem'
  291.     MM_DeleteFile system.tempfile
  292.     MM_DeleteFile system.output.asc
  293.  
  294. RETURN
  295.  
  296.  
  297. PGP_GetKeys:
  298.  
  299.     drop MSG_Stem.
  300.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  301.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  302.     ADDRESS command system.pgp.getkeys||' '||system.tempfile
  303.     MM_DeleteFile system.tempfile
  304.  
  305. RETURN
  306.  
  307.  
  308. PGP_Save:
  309.  
  310.     drop MSG_Stem.
  311.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  312.  
  313.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'       Do you really want to save the plaintext ?       '||'0a'X ||'                  (Orig. msg gets lost!) ' ; GADGETS='   _Yes   |*   _No   '
  314.     MM_Requester '"MM_PGPManager: Save"' 'REQTEXT' 'GADGETS'
  315.     IF RC~=1 THEN return
  316.     
  317.     if find(MSG_Stem.FLAGS, 'SAFE')~=0
  318.     then do
  319.         REQTEXT='          WARNING:'||'0a'X ||'0a'X ||'  The message is protected.  ' ; GADGETS='*   _Continue   |   _Ooops !!!   '
  320.         MM_Requester 'MM_PGPManager' 'REQTEXT' 'GADGETS'
  321.         IF RC~=1 THEN return
  322.     end
  323.  
  324.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  325.     ADDRESS command system.pgp.save||' -o '||system.output||' '||system.tempfile
  326.     MSG_Stem.FILE = system.output
  327.     MM_EditMsg system.area system.msg 'MSG_Stem'
  328.     MM_DeleteFile system.tempfile
  329.     MM_DeleteFile system.output
  330.  
  331. RETURN
  332.  
  333.  
  334. PGP_GetFile:
  335.  
  336.     drop MSG_Stem.
  337.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  338.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  339.     outfile=system.output
  340.     MM_FileReq 'outfile' ; if rc=1 then return
  341.     ADDRESS command system.pgp.getfile||' -o '||outfile||' '||system.tempfile
  342.     MM_DeleteFile system.tempfile
  343.  
  344. RETURN
  345.  
  346.  
  347. PGP_PutFile:
  348.     drop MSG_Stem.
  349.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  350.  
  351.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'       Do you want to encrypt and append a file ?       ' ; GADGETS='*   _Yes   |   _No   '
  352.     MM_Requester '"MM_PGPManager: Put File"' 'REQTEXT' 'GADGETS'
  353.     IF RC~=1 THEN return
  354.  
  355.     call Check_Write
  356.  
  357.     infile='RAM:'
  358.     MM_FileReq 'infile' ; if rc=1 then return
  359.  
  360.     user = MSG_Stem.TO
  361.     call Get_Multi_User
  362.  
  363.     ADDRESS command system.pgp.putfile||' -o '||system.output||' '||infile||' '||user
  364.     MM_ReadStem system.output 'MSG_Stem.TEXT' 'APPEND'
  365.     MM_WriteStem system.tempfile 'MSG_Stem.TEXT'
  366.  
  367.     MSG_Stem.FILE = system.tempfile
  368.     MM_EditMsg system.area system.msg 'MSG_Stem'
  369.     MM_DeleteFile system.tempfile
  370.     MM_DeleteFile system.output
  371.  
  372. RETURN
  373.  
  374.  
  375. PGP_Remove:
  376.  
  377.     drop MSG_Stem.
  378.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  379.  
  380.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  381.     ADDRESS command system.pgp.remove||' -o '||system.output||' '||system.tempfile
  382.  
  383.     REQTEXT='  Do you want to write the message to the message base ?  '||'0a'X ||'0a'X ||'           The signature has been removed.'||'0a'X ||'0a'X ||'         WARNING: Orig. message gets lost !'
  384.     GADGETS='   _Yes   |*   _No   '
  385.     MM_Requester '"MM_PGPManager: Remove"' 'REQTEXT' 'GADGETS'
  386.     IF RC=1 THEN do
  387.         if find(MSG_Stem.FLAGS, 'SAFE')~=0
  388.         then do
  389.             REQTEXT='          WARNING:'||'0a'X ||'0a'X ||'  The message is protected.  ' ; GADGETS='*   _Continue   |   _Ooops !!!   '
  390.             MM_Requester 'MM_PGPManager' 'REQTEXT' 'GADGETS'
  391.             IF RC~=1 THEN return
  392.         end
  393.  
  394.         MSG_Stem.FILE = system.output
  395.         MM_EditMsg system.area system.msg 'MSG_Stem'
  396.         MM_DeleteFile system.tempfile
  397.         MM_DeleteFile system.output
  398.     end
  399.     else do
  400.         outfile='RAM:Message'
  401.         MM_FileReq 'outfile'
  402.         MM_MoveFile system.output outfile
  403.     end
  404.  
  405.     REQTEXT='  The Signature is saved in a file.  '||'0a'X ||'0a'X ||'      Do you want to delete it ? '
  406.     GADGETS='*    _Yes    |    _No     '
  407.     MM_Requester '"MM_PGPManager: Remove"' 'REQTEXT' 'GADGETS'
  408.     IF RC=1 THEN MM_DeleteFile system.output.sig
  409.     else do
  410.         outfile='RAM:Message.sig'
  411.         MM_FileReq 'outfile'
  412.         MM_MoveFile system.output.sig outfile
  413.     end
  414. return
  415.  
  416.  
  417.  
  418. /*-----------------------------------------------------------------------*/
  419. /* Misc Functions & Subroutines:                                         */
  420. /*-----------------------------------------------------------------------*/
  421.  
  422.  
  423.  
  424. Get_MM_Msg:
  425.     IF ( UPPER(Word( MSG_Stem.TEXT.0, 1)) = 'TO:' ) THEN DO
  426.         system.email = MSG_Stem.TEXT.0
  427.         DO i = 2 TO MSG_Stem.TEXT.COUNT-1
  428.             j = i - 2
  429.             text.j = MSG_Stem.TEXT.i
  430.         END
  431.         text.count = MSG_Stem.TEXT.COUNT-2
  432.         MM_WriteStem system.tempfile 'text'
  433.      END
  434.      ELSE DO
  435.         system.email = ''
  436.         MM_WriteStem system.tempfile 'MSG_Stem.TEXT'
  437.      END
  438. RETURN
  439.  
  440. Edit_MM_Msg:
  441.     IF system.email='' THEN DO
  442.         MSG_Stem.FILE = system.output
  443.     END
  444.     ELSE DO
  445.         text.count=2
  446.         text.0 = system.email
  447.         text.1 = ''
  448.         MM_ReadStem system.output 'text' 'APPEND'
  449.         MM_WriteStem system.tempfile 'text'
  450.         MSG_Stem.FILE= system.tempfile
  451.     END
  452. RETURN
  453.  
  454.  
  455.  
  456. Get_User:
  457.     call Read_List
  458.     dummy.count=0
  459.     REQTEXT= '"Please enter the user id of the public key:"'
  460.     MM_SingleSelReq 'list' 'dummy' REQTEXT 'STR'
  461.     if rc=0 then do
  462.         user=''
  463.         user=dummy.0
  464.     end
  465.     else do
  466.         REQTEXT= '"Please enter the user id of the public key:"'
  467.         MM_StringReq REQTEXT 'user' ; if rc~=0 then exit
  468.     end
  469.     user= '"'||user||'"'
  470. return
  471.  
  472. Get_Multi_User:
  473.     call Read_List
  474.     dummy.count=0
  475.     REQTEXT= '"Please enter the user id of the public key:"'
  476.     MM_MultiSelReq 'list' 'dummy' REQTEXT 'STR'
  477.     if rc=0 then do
  478.         user=''
  479.         do x=0 to dummy.count-1
  480.             user= user||'"'||dummy.x||'" '
  481.         end
  482.     end
  483.     else do
  484.         REQTEXT= '"Please enter the user id of the public key:"'
  485.         MM_StringReq REQTEXT 'user' ; if rc~=0 then exit
  486.         user='"'||user|'"'
  487.     end
  488. return
  489.  
  490.  
  491. Read_List:
  492.     dummy.count=0
  493.     if list.count=0 then do
  494.         address command system.pgp.listkeys||' >'||system.tempfile
  495.         MM_ReadStem system.tempfile 'dummy'
  496.         do x=0 to dummy.count-1
  497.             parse var dummy.x 'pub ' . '/' . ' ' . '/' .'/' . ' ' name
  498.             if name~='' then do
  499.                 y=list.count; list.y=name; list.count=y+1; end
  500.         end
  501.     end
  502. return
  503.  
  504.  
  505. Check_Write:
  506.     if find(MSG_Stem.FLAGS, 'SENT')~=0 | find(MSG_Stem.FLAGS, 'IMP')~=0 | find(MSG_Stem.FLAGS, 'SAFE')~=0
  507.     then do
  508.         REQTEXT='                      WARNING:'||'0a'X ||'0a'X ||'  The message is protected, imported or already sent.  ' ; GADGETS='*   _Continue   |   _Ooops !!!   '
  509.         MM_Requester 'MM_PGPManager' 'REQTEXT' 'GADGETS'
  510.         IF RC=0 THEN exit
  511.     end
  512. return
  513.  
  514.  
  515.  
  516. Get_Mode:
  517.     do while system.funk=''
  518.         reqtext='   Please select a mode:   '
  519.         reqgadgets='*    _Read    |    _Write   |    _Help    |    _Quit    '
  520.         MM_Requester '"MM_PGPManager: Main Menu"' 'reqtext' 'reqgadgets'
  521.         mode=rc
  522.         select
  523.             when mode=1 then call Get_Mode_Read
  524.             when mode=2 then call Get_Mode_Write
  525.             when mode=3 then call Prog_Help
  526.             otherwise exit
  527.         end
  528.     end
  529. return
  530.  
  531.  
  532. Get_Mode_Read:
  533.     reqtext='   Please select a function:   '
  534.     reqgadgets='* _Read | Get _File | _Get Keys | _Save |_Remove Sig.| _Back '
  535.     MM_Requester '"MM_PGPManager: Read"' 'reqtext' 'reqgadgets'
  536.     func=rc
  537.     select
  538.         when func=1 then system.funk='READ'
  539.         when func=2 then system.funk='GETFILE'
  540.         when func=3 then system.funk='GETKEYS'
  541.         when func=4 then system.funk='SAVE'
  542.         when func=5 then system.funk='REMOVE'
  543.         otherwise return
  544.     end
  545. return
  546.  
  547.  
  548. Get_Mode_Write:
  549.     reqtext='   Please select a function:   '
  550.     reqgadgets='  _Write  | _Sign |W_rite&Sign|_Put File|_Add Key|* _Back '
  551.     MM_Requester '"MM_PGPManager:  Write"' 'reqtext' 'reqgadgets'
  552.     func=rc
  553.     select
  554.         when func=1 then system.funk='WRITE'
  555.         when func=2 then system.funk='SIGN'
  556.         when func=3 then system.funk='WRITES'
  557.         when func=4 then system.funk='PUTFILE'
  558.         when func=5 then system.funk='KEYADD'
  559.         otherwise return
  560.     end
  561. return
  562.  
  563.  
  564.  
  565. /*-----------------------------------------------------------------------*/
  566. /* Help:                                                                 */
  567. /*-----------------------------------------------------------------------*/
  568.  
  569.  
  570. Prog_Help:
  571.     mydummy=0
  572.     do while mydummy=0
  573.         reqtext='       MM_PGPManager'||'0a'X ||'0a'X ||'        Version 1.0'||'0a'X ||'0a'X ||'© 1996 by Sebastian Bleikamp'||'0a'X ||'0a'X ||'0a'X ||'  Please choose the topic:'
  574.         reqgadgets='  _Read  |  _Write  |*  _About  |  _Back  '
  575.         MM_Requester '"MM_PGPManager: Help"' 'reqtext' 'reqgadgets'
  576.         mode=rc
  577.         select
  578.             when mode=1 then call read_help
  579.             when mode=2 then call write_help
  580.             when mode=3 then call about_help
  581.             otherwise mydummy=1
  582.         end
  583.     end
  584. return
  585.  
  586.  
  587. read_help:
  588.     reqtext='Read     - Decrypt and read a message'||'0a'X ||'           using PGP´s viewer.'||'0a'X ||'0a'X ||'Get File - Write decrypted message to a file.'||'0a'X ||'           Useful for receiving binary files.'||'0a'X ||'0a'X ||'Get Keys - Get all keys out of a message'||'0a'X ||'           reading it.'||'0a'X ||'0a'X ||'Save     - Save the plaintext of the message'||'0a'X ||'           to the message base.'||'0a'X ||'           Encrypted msg. will be killed !'||'0a'X ||'0a'X ||'Remove   - Removes signatures from message.'||'0a'X ||'           (Message will be decrypted,'||'0a'X ||'           orig. message gets lost !)'
  589.     reqgadgets='*_Back to the help menu.'
  590.     MM_Requester '"MM_PGPManager: Help - Read"' 'reqtext' 'reqgadgets'
  591. return
  592.  
  593. write_help:
  594.     reqtext='Write        - Encrypt the current message.'||'0a'X ||'0a'X ||'Sign         - Sign the current message.'||'0a'X ||'0a'X ||'Write & Sign - Encrypt and sign the current'||'0a'X ||'               message.'||'0a'X ||'0a'X ||'Put File     - Encrypt a file, including binary'||'0a'X ||'               files, and append it to the'||'0a'X ||'               current message.'||'0a'X ||'0a'X ||'Add Key      - Add a public key from the pubring'||'0a'X ||'               to the message.'
  595.     reqgadgets='*_Back to the help menu.'
  596.     MM_Requester '"MM_PGPManager: Help - Write"' 'reqtext' 'reqgadgets'
  597. return
  598.  
  599. about_help:
  600.     reqtext='            MM_PGPManager'||'0a'X ||'0a'X ||'             Version 1.0'||'0a'X ||'0a'X ||'    © 1996 by Sebastian Bleikamp'||'0a'X ||'        (All rights reserved.)'||'0a'X ||'0a'X ||'How to contact the author:'||'0a'X ||'0a'X ||'Internet: <bleikamp@mail.rhein-ruhr.de>'||'0a'X ||'Fidonet:  <2:2448/10.131>'||'0a'X ||'0a'X ||'Snail-Mail:'||'0a'X ||'0a'X ||'      Sebastian Bleikamp'||'0a'X ||'      Lothringer Weg 37a'||'0a'X ||'      45481 Mülheim an der Ruhr'||'0a'X ||'      Germany'
  601.     reqgadgets='*_Back to the help menu.'
  602.     MM_Requester '"MM_PGPManager: Help - Write"' 'reqtext' 'reqgadgets'
  603. return
  604.  
  605.  
  606.  
  607. /*-----------------------------------------------------------------------*/
  608. /* Read Config:                                                          */
  609. /*-----------------------------------------------------------------------*/
  610.  
  611. Read_Config:
  612.  
  613.     dummy.count=0
  614.     MM_ReadStem system.configfile 'dummy'
  615.     if dummy.count=0 then do
  616.         say "***Error: Config file not found !!"
  617.         say
  618.         exit 20
  619.     end
  620.  
  621.     do x=0 to dummy.count-1
  622.         parse var dummy.x pre '#' keyword ' ' inhalt
  623.         if (pre='') & (keyword~='') then do
  624.             select
  625.                 when keyword='SYSOPID'        then system.sysopid        = inhalt
  626.                 when keyword='OUTPUT'         then system.output         = inhalt
  627.                 when keyword='TEMPFILE'       then system.tempfile       = inhalt
  628.                 when keyword='PGP_READ'       then system.pgp.read       = inhalt
  629.                 when keyword='PGP_WRITE'      then system.pgp.write      = inhalt
  630.                 when keyword='PGP_WRITE_SIGN' then system.pgp.write_sign = inhalt
  631.                 when keyword='PGP_SIGN'       then system.pgp.sign       = inhalt
  632.                 when keyword='PGP_KEYADD'     then system.pgp.keyadd     = inhalt
  633.                 when keyword='PGP_GETKEYS'    then system.pgp.getkeys    = inhalt
  634.                 when keyword='PGP_SAVE'       then system.pgp.save       = inhalt
  635.                 when keyword='PGP_GETFILE'    then system.pgp.getfile    = inhalt
  636.                 when keyword='PGP_PUTFILE'    then system.pgp.putfile    = inhalt
  637.                 when keyword='PGP_REMOVE'     then system.pgp.remove     = inhalt
  638.                 when keyword='PGP_LISTKEYS'   then system.pgp.listkeys   = inhalt
  639.                 otherwise nope
  640.             end
  641.         end
  642.     end
  643. return
  644.  
  645.  
  646.